In Perl, why do I need to @b = @{dclone(\@a)}? Why can't I just @b = dclone(\@a)?

Posted by synapz on Stack Overflow See other posts from Stack Overflow or by synapz
Published on 2010-01-06T16:04:25Z Indexed on 2010/05/31 4:32 UTC
Read the original article Hit count: 180

Filed under:
|

I have an array of various things including scalars and arrays. I want to make a copy of it, and tried the following:

@b = dclone(\@a)

but then when I try to read one of the scalar values from b, I get nothing back.

Everything appears to work when I copy it this way, though:

@b = @{dclone(\@a)}

What is the reason?

© Stack Overflow or respective owner

Related posts about perl

Related posts about arrays